package br.com.virtual.base.uteis;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;

public class VirtualConverter {

	public static Calendar getDate(String str, String pattern) {
		SimpleDateFormat sdf = new SimpleDateFormat(pattern);
		try {
			Calendar c = Calendar.getInstance();
			c.setTime(sdf.parse(str));
			return c;
		} catch (ParseException e) {
			return null;
		}
	}

	public static String getStrDate(Calendar cal, String pattern) {
		SimpleDateFormat sdf = new SimpleDateFormat(pattern);
		return sdf.format(cal.getTime());
	}

}
